package com.demo.common.protocal;

import lombok.Data;

@Data
public class MyMessage {

    private OpType type;

    private int contentLength;

    private Object content;

    public static MyMessage PingMessage() {
        MyMessage m = new MyMessage();
        m.setType(OpType.PING);
        return m;
    }

    public static MyMessage PongMessage() {
        MyMessage m = new MyMessage();
        m.setType(OpType.PONG);
        return m;
    }

    public static MyMessage StringMessage(String txt) {
        MyMessage m = new MyMessage();
        m.setType(OpType.DATA);
        m.setContent(txt);
        return m;
    }

}
